package com.ynny;

import com.ynny.entity.Student;
import com.ynny.mapper.StudentMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class StudentTest02 {
    @Test
    public void test01() throws IOException {
        InputStream resourceAsStream =
                Resources.getResourceAsStream("mybatis-config.xml");
        SqlSessionFactory sessionFactory =
                new SqlSessionFactoryBuilder().build(resourceAsStream);


        SqlSession sqlSession =
                sessionFactory.openSession(true);


        //获取接口
        StudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);

//        List<Student> list = studentMapper.selectAllStudent();
//
//        System.out.println(list);

//        int i = studentMapper.updateStudentBynumber();


        List<Student> list02 = studentMapper.selectStudentByidentity();

        System.out.println(list02);

        //        int i =studentMapper.deleteStudentBynumber();
        //        System.out.println(i);




    }
}
